const path = require('path');
console.log('当前文件的路径是', __dirname);
module.exports = {
    entry: './src/main.js',
    output: {
        path: path.resolve(__dirname, './build'),
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [{
                        loader: 'style-loader'
                    },
                    {
                        loader: 'css-loader',
                        options:{
                            importLoaders:2
                        }
                    },
                    {
                        loader: 'postcss-loader'
                    }
                ]
            },
            {
                test: /\.less$/,
                use: [
                    "style-loader",
                    {
                        loader: 'css-loader',
                        options:{
                            importLoaders:2
                        }
                    },
                    "postcss-loader",
                    "less-loader"
                ]
            },
            {
                test:/\.(jpg|jpeg|png|gif|svg)$/,
                use:[{
                    loader:"url-loader",
                    options:{
                        name:'img/[name]_[hash:6].[ext]',
                        limit: 50*1024
                    }
                }]
            }
        ]
    }
}